package proxy.cglib.service.impl;

import org.springframework.cglib.core.DebuggingClassWriter;
import org.springframework.cglib.proxy.Enhancer;

public class CglibTest {
  public static void main(String[] args) {
    System.setProperty(DebuggingClassWriter.DEBUG_LOCATION_PROPERTY,"D:");

    Enhancer enhancer = new Enhancer();

    enhancer.setSuperclass(CglibDao.class);

    enhancer.setCallback(new CglibInterceptor());

    CglibDao cglibDao = (CglibDao) enhancer.create();

    cglibDao.update("Ethan");

    cglibDao.select();
  }
}
